<template>
    <div class="body_background" :style="GetWindowBackground">
        <div class="body_background padding-top10">
            <div class="block-box items-start">
                <div class="big-font-size three-color">供应商信息</div>
                <ul class="create-box">
                    <li>
                        <div class="big-font-size main-color supplier-title white-space">供应商名称：</div>
                        <div class="three-color">供应商名称</div>
                    </li>
                    <li>
                        <div class="big-font-size main-color supplier-title white-space">联系人姓名：</div>
                        <div class="three-color">张安</div>
                    </li>
                    <li>
                        <div class="big-font-size main-color supplier-title white-space">联系人电话：</div>
                        <div class="three-color">15222222222</div>
                    </li>
                    <li>
                        <div class="big-font-size main-color supplier-title white-space">所在地区：</div>
                        <div class="three-color">天津市-天津-滨海新区</div>
                    </li>
                    <li>
                        <div class="big-font-size main-color supplier-title white-space">详细地址：</div>
                        <div class="three-color">这里是详细地址这里是详细地址这里是详细地址</div>
                    </li>
                </ul>
            </div>
            <div class="block-box items-start">
                <div class="big-font-size three-color">资金信息</div>
                <ul class="create-box">
                    <li>
                        <div class="big-font-size main-color supplier-title white-space">已履约贷款：</div>
                        <div class="three-color">￥1212313</div>
                    </li>
                    <li>
                        <div class="big-font-size main-color supplier-title white-space">待履约贷款：</div>
                        <div class="three-color">￥54646</div>
                    </li>
                </ul>
            </div>
            <div class="block-box items-start">
                <div class="big-font-size three-color">商品信息</div>
                <ul class="create-box">
                    <li>
                        <div class="big-font-size main-color white-space">商品数：</div>
                        <div class="three-color">2</div>
                    </li>
                    <div class="more-box" @click="lookMoreOrder">
                        <div class="main-color big-font-size">查看更多</div>
                        <img src="../../assets/img/arrow.png" :class="goodsShow==true?'active-up':''">
                    </div>
                    <div :class="goodsShow==true?'display-block':'display-none'" class="list-box">
                        <div class="order-content-box"
                             v-for="(item,index) in goodsList"
                             :key="item.id"
                        >
                            <img :src="item.imgUrl"/>
                            <div class="order-info-box">
                                <div class="main-color big-font-size">{{item.title}}</div>
                                <div class="goods-info-box">
                                    <div>
                                        <div class="three-color small-font-size">保存：常温</div>
                                        <div class="three-color small-font-size">规格：20g</div>
                                        <div class="three-color small-font-size">
                                            指导价<span class="price-color big-font-size">￥20</span>/袋
                                        </div>
                                    </div>
                                    <div class="price-color big-font-size goods-count"
                                         @click="unBundlingFun(item)"
                                    >解绑</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </ul>
            </div>
            <div class="block-box items-start">
                <div class="big-font-size main-color">备注</div>
                <textarea class="note-content">这里是备注内容</textarea>
            </div>
            <mt-button class="editButton background white-color" @click="goCreateFun">编辑</mt-button>
        </div>
    </div>
</template>

<script>

    export default {
        name: "SupplierDetail",
        data() {
            return {
                id:'',
                GetWindowBackground: {
                    'min-height': ''
                },
                goodsShow: false,
                goodsList: [
                    {
                        id: 1,
                        title: "秘制小番茄50g",
                        spec: '500g/袋',
                        weight: '500g',
                        warehouse: '常温',
                        num: 0,
                        imgUrl:
                            "https://t00img-c.yangkeduo.com/goods/images/2020-08-13/ce99a1b2f665ba478d9573c314686c5d.jpeg"
                    }, {
                        id: 2,
                        title: "秘制小番茄500g",
                        spec: '500g/袋',
                        weight: '500g',
                        warehouse: '常温',
                        num: 0,
                        imgUrl:
                            "https://t00img-c.yangkeduo.com/goods/images/2020-08-13/ce99a1b2f665ba478d9573c314686c5d.jpeg"
                    }, {
                        id: 3,
                        title: "秘制小番茄500g",
                        spec: '500g/袋',
                        weight: '500g',
                        warehouse: '常温',
                        num: 0,
                        imgUrl:
                            "https://t00img-c.yangkeduo.com/goods/images/2020-08-13/ce99a1b2f665ba478d9573c314686c5d.jpeg"
                    }, {
                        id: 4,
                        title: "秘制小番茄500g",
                        spec: '500g/袋',
                        weight: '500g',
                        warehouse: '常温',
                        num: 0,
                        imgUrl:
                            "https://t00img-c.yangkeduo.com/goods/images/2020-08-13/ce99a1b2f665ba478d9573c314686c5d.jpeg"
                    }, {
                        id: 5,
                        title: "秘制小番茄500g",
                        spec: '500g/袋',
                        weight: '500g',
                        warehouse: '常温',
                        num: 0,
                        imgUrl:
                            "https://t00img-c.yangkeduo.com/goods/images/2020-08-13/ce99a1b2f665ba478d9573c314686c5d.jpeg"
                    }
                ],
            }
        },
        mounted() {
            this.id = this.$route.query.id;
            console.log(this.id)
        },
        methods: {
            //查看更多订单
            lookMoreOrder(item) {
                this.goodsShow = !this.goodsShow
            },
            //解绑
            unBundlingFun(item){
                console.log(item.id)
            },
            //编辑
            goCreateFun(item){
                this.$router.push('/SupplierCreate?id='+this.id)
            },
            //跳转供应商列表
            goSupplierListFun() {
                this.$router.push('/SupplierList')
            },
            getBodyHeight() {
                // 获取浏览器高度，减去顶部搜索栏和导航栏的值 55 + 50（可动态获取）,再减去底部高度值60
                this.GetWindowBackground['min-height'] = window.innerHeight + 'px'
            },
        },
        // 生命周期 - 创建完成（可以访问当前this实例）
        created() {
            window.addEventListener('resize', this.getBodyHeight) // 注册监听器
            this.getBodyHeight() // 页面创建时先调用一次
        },
        // 生命周期 - 销毁完成
        destroyed() {
            window.removeEventListener('resize', this.getBodyHeight)
        },
    }
</script>

<style lang="scss" scoped>

    .padding-top10 {
        padding-top: 15px;
    }

    .block-box {
        width: calc(100% - 40px);
        padding: 10px;
        border-radius: 8px;
        margin-bottom: 15px;
    }
    .items-start{
        width: calc(100% - 50px);
        padding: 15px 15px 0 15px;
    }

    .create-box {
        width: 100%;
        padding-bottom: 10px;
        padding-top: 5px;
        li {
            width: 100%;
            display: flex;
            padding: 10px 0;
            .supplier-title {
                width: 90px;
                text-align: right;
            }
            .three-color {
                width: calc(100% - 100px);
                text-align: left;
            }
        }
    }

    .more-box {
        width: 100%;
        text-align: left;
        display: flex;
        align-items: center;
        justify-content: center;

        img {
            width: 10px;
            height: 6px;
            margin: 0 5px;
        }
        .active-up {
            transform: rotate(180deg);
            -webkit-transform: rotate(180deg);
            -moz-transform: rotate(180deg);
        }
    }

    .list-box {
        margin-top: 10px;
    }

    .order-content-box {
        width: 100%;
        display: flex;
        padding: 7px 0;
        img {
            width: 80px;
            height: 80px;
            margin-right: 10px;
            border-radius: 10px;
        }
        .order-info-box {
            width: calc(100% - 90px);
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            text-align: left;
        }
        .goods-info-box{
            display: flex;
            .goods-count {
                margin-left: auto;
                align-items: center;
                display: flex;
            }
        }
    }
    .note-content{
        width: calc(100% - 20px);
        border-radius: 6px;
        border: 1px solid #eef0f3;
        margin: 8px 0 15px 0;
        text-align: left;
        font-size: 13px;
        padding: 10px;
    }
    .editButton{
        width: 80%;
        margin: 30px 0;
        border-radius: 8px;
        letter-spacing: 1px;
        font-size: 15px;
    }
</style>